<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/financeReport.do?action=inventoryInfo" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<SCRIPT language='JavaScript'>
	var dateElement = "";
	function openCalendar(dateValue)
	{
		dateElement = dateValue;
  		newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html',
'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
  		newWindow.moveTo(550,180);
  		newWindow.focus();
    }
	function assignDate(passedValue)
    {   
		dateElement.value=passedValue;
		window.focus();
    }

/*
* Date validation 
*/

function getYear(d) { 
  return (d < 1000) ? d + 1900 : d;
  }

function isDate (year, month, day) {

  month = month - 1;  
  var tempDate = new Date(year,month,day);
  if ( (getYear(tempDate.getYear()) == year) &&
     (month == tempDate.getMonth()) &&
     (day == tempDate.getDate()) )
      return true;
  else
     return false
  }


/*
* There was a problem with the CR, if the date entered was of the format (m/d/yyyy) the prompt sent was not recognised by
* CR tool thus I had to append 0 infront of the month before it was sent to the Proc in the CR.
* This function takes care of the aforesaid problem.
*/
	function dateCheck(){
	
		var date_check = document.toshibaInfo.asOfDate.value;
		var pa = document.getElementById("errors");
	
		if (date_check=='')
			date_check='0';
		else{
			var month, date, year;
			var m;
			var day_check  = date_check.split('/');
			month=day_check[0];
			date=day_check[1];
			year=day_check[2];
			if (month<10) {
				if (month.length == 1) 
					month = "0"+month;
			}
			
			if (date<10){
				if (date.length == 1) 
					date = "0"+date;
			}
			date_check = month+"/"+date+"/"+year;
									
		}
		var check = date_check.split('/');
		if (check[0]== '00')
			date_check = '0';
		if (date_check!='0'){
			if (!isDate(year, month, date)){
				pa.innerHTML="Please enter a valid Date...!";
				date_check = 'InValid';
			}
		}

		return date_check;
	}


	function dateRange(){

		var period="";
		var cat="";
		var d = new Date();
		var day = d.getDate();
		var month = d.getMonth()+1;
		var year = d.getFullYear();
		var hour = d.getHours();
		var min = d.getMinutes();
		var sec = d.getSeconds();
		if (month < 10)
			month = "0"+month;
		if (day<10)
			day = "0"+day;
		var today = month+"/"+day+"/"+year;
		var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
		if (dateCheck()=='InValid')
			return;
		else {
			var datePrompt = dateCheck();
		}

		document.toshibaInfo.prompt2.value = document.toshibaInfo.asOfDate.value;
		if(document.toshibaInfo.prompt2.value =='')
		{
    		document.toshibaInfo.prompt2.value ='0';
		}
		document.toshibaInfo.prompt3.value= defaultPrompt;
		document.toshibaInfo.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/Toshiba_wip_details.rpt";
		document.toshibaInfo.submit();
	}
</SCRIPT>

<TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type='text/css' rel='stylesheet'>
</HEAD>
<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight="0" marginwidth="0">

<form name="toshibaInfo" method="post">
<input type="hidden" name="prompt0" value="0">
<input type="hidden" name="prompt1" value="0">
<input type="hidden" name="prompt2">
<input type="hidden" name="prompt3" value="0">


<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@ include file="/jsp/operations/reports_side_menu.jsp" %>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->

<center><span class="NArialW">Toshiba Wip Report</span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>

  <table border="0" width="90%" align=right>
   <tr><td  align="left" class='NArialL'><b><font face="Verdana" size="-5" align="center" color="#ff0000" id="errors"></font><b></td></tr>	
   <tr><td><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
	<tr>
		<td align="left"><font class="NArialL"> As of Date
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="text" name="asOfDate" size="20" class="txfield"></font>
		<a href="javascript:openCalendar(document.toshibaInfo.asOfDate)" onMouseOver="window.status='Click to select date';return true" onmouseout="window.status='';return true">
		<img src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20 border="0"></a>
		</td>
	</tr>
	<tr>
		<TD bgcolor="#ffffff">
		<IMG height=1 	 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1>
		</TD>
	</TR>
	<tr>
      <td align="center">
	  <a href="javascript:dateRange()">
	  <img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53"   height="17" onMouseOver="window.status='Click to Generate Report';return true" onmouseout="window.status='';return true" title="Click here to Generate Report"/></a>
      </td>
    </tr>
  </table>

<!-- till here -->
</TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</form>
</BODY>
</HTML>






